package com.qd.dict.sys;

import com.cdqidi.dict.annotation.FieldBind;
import com.cdqidi.dict.config.IFieldProcess;
import com.qd.common.dict.DictConstant;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

/**
 * 回执表发送结果
 *
 * @author sjk
 */
@Component
@RequiredArgsConstructor
public class SysSendResultProcessImpl implements IFieldProcess {
    @Override
    public String processName() {
        return DictConstant.SYS_SEND_RESULT;
    }
    @Override
    public Object convertValue(FieldBind fieldBind, Object fieldValue) {
        if (null == fieldValue) {
            return "";
        }
        int sendResult = Integer.parseInt(fieldValue.toString());
        if (sendResult == 1) {
            return "成功";
        }
        if (sendResult == 2) {
            return "失败";
        }
        return "";
    }
}